<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}{{ settings.site_title }}{% endblock %}</title>
    <meta name="description" content="{{ settings.description }}">
    
    <!-- 现代化CSS样式 -->
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    
    <!-- 字体 -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    
    <!-- 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/feather-icons/4.29.0/feather.min.css">
    
    {% block head %}{% endblock %}
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar">
        <div class="nav-container">
            <div class="nav-brand">
                <a href="{{ url_for('index') }}" class="brand-link">
                    <span class="brand-logo">{{ settings.site_logo }}</span>
                    <span class="brand-text">{{ settings.site_title }}</span>
                </a>
            </div>
            
            <div class="nav-menu" id="nav-menu">
                <a href="{{ url_for('index') }}" class="nav-link">首页</a>
                {% if pages %}
                    {% for page in pages %}
                        {% if page.published %}
                            <a href="{{ url_for('page_detail', slug=page.slug) }}" class="nav-link">{{ page.title }}</a>
                        {% endif %}
                    {% endfor %}
                {% endif %}
            </div>
            
            <div class="nav-toggle" id="nav-toggle">
                <span class="bar"></span>
                <span class="bar"></span>
                <span class="bar"></span>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <main class="main-content">
        {% block content %}{% endblock %}
    </main>

    <!-- 页脚 -->
    <footer class="footer">
        <div class="footer-container">
            <div class="footer-content">
                <p>Powered by <a href="https://gitee.com/C41cdy/micro-blog" target="_blank">MicroBlog</a>.</p>
            </div>
        </div>
    </footer>

    <!-- Flash消息 -->
    {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            <div class="flash-messages">
                {% for category, message in messages %}
                    <div class="flash-message flash-{{ category }}">
                        <span class="flash-text">{{ message }}</span>
                        <button class="flash-close" onclick="this.parentElement.remove()">×</button>
                    </div>
                {% endfor %}
            </div>
        {% endif %}
    {% endwith %}

    <!-- JavaScript -->
    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
    {% block scripts %}{% endblock %}
</body>
</html>
